using System.Data.Entity.ModelConfiguration;
using ExampleWebApplication.Entities;

namespace ExampleWebApplication.Infraestruture.EntityFramework.EntityTypeConfigurations
{
    public class ProductConfiguration : EntityTypeConfiguration<Product>
    {
        public ProductConfiguration()
        {
            Property(p => p.Units_On_Order).HasColumnName("UnitsOnOrder");

            Ignore(p => p.EntityProp);

            HasRequired(p => p.Category).WithMany(c => c.Products).Map(m => m.MapKey("CategoryID"));

            // Disable to make work the Example #08: Direct usage of a TEntity (without TEntity to TViewModel mappings)
            Ignore(p => p.Supplier);
        }

    }
}